<?php
/**
 * Prado Portal.
 *
 * @author Steen Rabol <steen.rabol@gmail.com>
 * @link http://www.pradoportal.dk/
 * @copyright Copyright &copy; 2006,2007,2008 Steen Rabol
 * @license http://www.pradoportal.dk
 * @version $Id: Home.php 320 2008-11-23 07:18:37Z steen.rabol@gmail.com $
 *
 */

Prado::using('Application.Common.Data.PortalToDoRecord');
Prado::using('Application.Common.Data.PortalUserRecord');

class Test extends PortalAdminPage
{
	const CONFIG_FILE		= 'Application.Data.Manifest';
	public function onLoad($param)
	{
		parent::onLoad($param);
		$this->AdminPageTitle = 'Home';
		
		$doc			= new TXmlDocument('1.0','utf-8');
		$doc->TagName	='PradoPortal';
		
		$typeElm = new TXmlElement('Type');
		$typeElm->setAttribute('Id','Portlet');
		$typeElm->setAttribute('Name','TestPortlet');
		$doc->Elements[] = $typeElm;
		
		$properties = new TXmlElement('Properties');
		$typeElm->Elements[] = $properties;
		
		$propName = new TXmlElement('Name');
		$propName->Value = 'Test portlet';
		$properties->Elements[] = $propName;
		
		$propSystemName = new TXmlElement('SystemName');
		$propSystemName->Value = 'TestPortlet';
		$properties->Elements[] = $propSystemName;

		$propVersion = new TXmlElement('Version');
		$propVersion->Value = '1.0';
		$properties->Elements[] = $propVersion;
		
		// Files
		$filesElm = new TXmlElement('Files');
		$doc->Elements[] = $filesElm;
		
		$filesAdminElm = new TXmlElement('Files');
		$filesAdminElm->setAttribute('Id', 'TestPortlet.Admin');
		$filesElm->Elements[] = $filesAdminElm;

		$fileElm = new TXmlElement('File');
		$fileElm->Value = 'TestPortlet.php';
		$filesAdminElm->Elements[] = $fileElm;
		
		$fileElm = new TXmlElement('File');
		$fileElm->Value = 'TestPortlet.page';
		$filesAdminElm->Elements[] = $fileElm;
		
		$filesCommonElm = new TXmlElement('Files');
		$filesCommonElm->setAttribute('Id', 'TestPortlet.Common');
		$filesElm->Elements[] = $filesCommonElm;

		$fileElm = new TXmlElement('File');
		$fileElm->Value = 'TestPortletCommon.php';
		$filesCommonElm->Elements[] = $fileElm;
		
		$filesEditElm = new TXmlElement('Files');
		$filesEditElm->setAttribute('Id', 'TestPortlet.Edit');
		$filesElm->Elements[] = $filesEditElm;

		$fileElm = new TXmlElement('File');
		$fileElm->Value = 'TestPortlet.php';
		$filesEditElm->Elements[] = $fileElm;
		
		$fileElm = new TXmlElement('File');
		$fileElm->Value = 'TestPortlet.page';
		$filesEditElm->Elements[] = $fileElm;

		$filesInstallElm = new TXmlElement('Files');
		$filesInstallElm->setAttribute('Id', 'TestPortlet.Install');
		$filesElm->Elements[] = $filesInstallElm;

		$fileElm = new TXmlElement('File');
		$fileElm->Value = 'TestPortlet.php';
		$filesInstallElm->Elements[] = $fileElm;
		
		$fileElm = new TXmlElement('File');
		$fileElm->Value = 'TestPortlet.page';
		$filesInstallElm->Elements[] = $fileElm;

		$fileElm = new TXmlElement('File');
		$fileElm->Value = 'MySQL.php';
		$filesInstallElm->Elements[] = $fileElm;

		// Portlet root files
		$filesRootElm = new TXmlElement('Files');
		$filesRootElm->setAttribute('Id', 'TestPortlet');
		$filesElm->Elements[] = $filesRootElm;

		$fileElm = new TXmlElement('File');
		$fileElm->Value = 'TestPortlet.php';
		$filesRootElm->Elements[] = $fileElm;
		
		$fileElm = new TXmlElement('File');
		$fileElm->Value = 'TestPortlet.page';
		$filesRootElm->Elements[] = $fileElm;
		
		$doc->saveToFile(Prado::getPathOfNamespace(self::CONFIG_FILE,'.xml'));
	}

	private function createParameter($id,$value)
	{
		$element=new TXmlElement('parameter');
		$element->Attributes['id']=$id;
		$element->Attributes['value']=TPropertyValue::ensureString($value);
		return $element;
	}

}

?>